import request from '@/utils/request.js'
// (path, params = {}, loading = true, method = "POST")  接口要传递的参数

/**
 * @param goods_type  2 获取首页 1 获取商家的分类
*/
 // 获取首页分类
export const GetHomeCategoryApi = () => {
	return request('/shop/category/category', {goods_type: 2})
}

// 获取首页商品 /shop/goods/get_list2
/**
 * @param page        分页页码，数字类型
 * @param search      搜索时需要
 * @param longitude
 * @param latitude
 * @param order       排序方式 1=评分最高 2=销量最高 3=距离最近 4=个人 5=商家
 * @param category_id 从首页分类跳转到商品类表页需传分类ID
*/
export const GetHomeGoodsListApi = (params) => {
	return request('/shop/goods/get_list2', params)
}
// 获取商品详情{{host}}/shop/goods/getGoodsDetail
/**
 * @param spu 商品spu
*/
export const GetGoodsDetailsApi = (params) => {
	return request('/shop/goods/getGoodsDetail', params)
}

// 获取商品评价 {{host}}/shop/goods/goods_comment
/**
 * @param goods_id
 * @param search_type 1 最新 2 好评 3 差评 4 有图
*/
export const GetGoodsEvaApi = (params) => {
	return request('/shop/goods/goods_comment', params)
}

// 收藏/取消收藏商品 {{host}}/shop/collection/collection
/**
 * @param spu 商品spu
*/
export const CollectGoodsApi = (params) => {
	return request('/shop/collection/collection', params)
}
// 获取商家详情 {{host}}/shop/shop/detail
/**
 * @param shop_id 商家id
 * @param longitude
 * @param latitude
*/
export const GetShopDetailsApi = (params) => {
	return request('/shop/shop/detail', params)
}
// 投诉商家 {{host}}/shop/goods/goods_complaint
/**
 * @param complaint_cause 投诉类型 公共配置文件获得
 * @param complaint_info 投诉内容
 * @param img 投诉图片
 * @param shop_id 商家id
 * @param mobile 联系电话
*/
export const ComplaintShopApi = (params) => {
	return request('/shop/goods/goods_complaint', params)
}
// 收藏店铺 {{host}}/shop/collection/shop_like
/**
 * @param shop_id 商家id
*/
export const CollectShopApi = (params) => {
	return request('/shop/collection/shop_like', params)
}
// 获取店铺分类 {{host}}/shop/category/category
/**
 * @param shop_id 商家id
 * @param goods_type 固定值 1
*/
export const GetShopCategoryApi = (params) => {
	return request('/shop/category/category', params)
}

// 获取商家商品列表 {{host}}/shop/goods/get_list
/**
 * @param "page": 1, //分页页码，数字类型
 * @param "page_size": 20,
 * @param "filters": { "goods_type": 1, //固定传1 "search": "抖", //搜索关键字 "shop_id": "6", //店铺ID   传商家ID表示获得该商家商品 "category_id": "114", //分类ID  传分类ID表示获得该分类下的商品 "active": "1", //固定传参 "status": "checked" //固定传参 },
 * @param "longitude": "113.50", //经度
 * @param "latitude": "34.81" //纬度
*/
export const GetShopGoodsListApi = (params) => {
	return request('/shop/goods/get_list', params)
}
// 获取商品多规格参数 {{host}}/shop/goods/getSkuBySpece
/**
 * @param spu 商品 spu
 * @param specValue [{"spece_id": 140, //商品详情中 speceAll.id "value": 267 //商品详情中 speceAll.spece_value.id},]
*/
export const GetGoodsSpecApi = (params) => {
	return request('/shop/goods/getSkuBySpece', params)
}
// 获取商家评价列表 {{host}}/shop/goods/goods_comment_shop
/**
 * @param shop_id 商家id
*/
export const GetShopEvaluateListApi = (params) => {
	return request('/shop/goods/goods_comment_shop', params)
}